package net.pinnoocle.playdao.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.pinnoocle.playdao.entity.Coupon;
import net.pinnoocle.playdao.entity.UserCoupon;
import net.pinnoocle.playdao.entity.shopPc.coupon.CouponListPageVo;
import net.pinnoocle.playdao.entity.shopPc.coupon.CouponListSearchParams;
import net.pinnoocle.playdao.entity.web.user.UserCouponListPageVo;
import net.pinnoocle.playdao.entity.web.user.UserCouponListSearchParams;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 优惠券(Coupon)表数据库访问层
 *
 * @author ye
 * @since 2021-10-28 18:33:35
 */
@Mapper
public interface CouponDao extends BaseMapper<Coupon> {

    /**
     * 待领取优惠券
     * @param page
     * @param params
     * @return
     */
    Page<CouponListPageVo> couponList(Page page, @Param("params")CouponListSearchParams params);

    /**
     * 用户优惠券列表
     * @param page
     * @param params
     * @return
     */
    Page<UserCouponListPageVo> userCouponList(Page page, @Param("params") UserCouponListSearchParams params);

    /**
     * 修改优惠券状态
     * @param couponId
     * @param status
     * @return
     */
    boolean changeCouponStatus(@Param("couponId") String couponId, @Param("status") Integer status);

    /**
     * 修改用户优惠券状态
     * @param userCouponId
     * @param status
     * @return
     */
    boolean changeUserCouponStatus(@Param("userCouponId") String userCouponId, @Param("status") Integer status);

    /**
     * 判断用户是否领取了优惠券
     * @param baseCouponId
     * @param userId
     * @return
     */
    UserCoupon findUserCoupon(@Param("baseCouponId") String baseCouponId,@Param("userId") String userId);

}